package wechat.rcv;

import java.util.Date;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import wechat.rcv.data.CheckInResponse;
import wechat.rcv.util.TimeFormatter;

import edu.fudan.mylang.pf.IObjectFactory;

@RestController
@Transactional
public class JsonCheckInController {
	final static Logger logger = Logger.getLogger(JsonCheckInController.class.getName());
	private IObjectFactory entities;

	@Autowired
	public JsonCheckInController(IObjectFactory entities) {
		this.entities = entities;
	}
	@RequestMapping("/ajaxcheckin")
	public CheckInResponse Checkin(@RequestParam(value = "eventid", defaultValue = "") String eventid) {
		logger.info("***************Ajaxcheckin Request received!***************");
		int code =-1;
		Date date = new Date();
		return new CheckInResponse(code, TimeFormatter.timeFormat(date));
	}
}